﻿namespace DBServer.Selenium.Extenium.Path
{
    public class ExtComponentPath : IPath
    {
        private readonly string _name;
        private readonly string _extPath = "window.Ext";

        public ExtComponentPath(string name)
        {
            _name = name;
        }

        public ExtComponentPath(string name, string extPath)
        {
            _name = name;
            _extPath = extPath;
        }

        public string Eval()
        {
            return _extPath + ".getCmp('" + _name + "')";
        }

        public override string ToString()
        {
            return Eval();
        }

        public string Id()
        {
            return _name;
        }
    }
}
